package com.ysd.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.consultDaoImpl;
import com.ysd.entity.consult;

/**
 * Servlet implementation class consultUpdateServlet
 */
@WebServlet("/consultUpdate")
public class consultUpdateServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    consultDaoImpl cs=new consultDaoImpl();       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public consultUpdateServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		int id=Integer.parseInt(request.getParameter("id"));
		String title=request.getParameter("title");
		String jianluezixun=request.getParameter("jianluezixun");
		String detail=request.getParameter("detail");
		consult c=new consult(id,title,jianluezixun,detail);
		int i=cs.update(c);
		PrintWriter pw=response.getWriter(); 
		pw.write(i+"");
		pw.flush();
		pw.close();
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
